<?PHP
include_once "ini.php";
$nom = $_POST['nom'];

dbconnect();

$sql = "INSERT INTO `images` (`id_image` , `id_user` , `nom_image` , `coord_x` , `coord_y` , `coord_z` , `droit`, `posted` ) VALUES ( NULL , '1', '".$nom."', '', '', '', 'private', 'non' );";
            $sqlresults = mysql_query($sql);
            if (!$sqlresults)
            {
                echo '{"status":"ERROR: '.$sql.'"}';
            }
			else{
				$sql2 = "SELECT * FROM `images` ORDER BY id_image DESC LIMIT 1;";
				$result = mysql_query($sql2);
				$tab = mysql_fetch_assoc($result);
				echo $tab['id_image'];
			}


dbclose();

?>